# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time        : 2021/9/10 15:46
@Author      : Albert Darren
@Contact     : 2563491540@qq.com
@File        : RGB_split.py
@Version     : Version 1.0.0
@Description : TODO
@Created By  : PyCharm
"""
import cv2
import matplotlib.pyplot as plt
import numpy as np

img = cv2.imread("../experiment_fig/aio.png")
b0, g0, r0 = cv2.split(img)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

zeros = np.zeros(img.shape[:2], dtype="uint8")
b = cv2.merge([zeros, zeros, b0])
g = cv2.merge([zeros, g0, zeros])
r = cv2.merge([r0, zeros, zeros])

plt.figure('AJu', figsize=(10, 10))  # 窗口名称和大小
plt.subplot(2, 3, 2), plt.title('aio'), plt.imshow(img,cmap="gray"), plt.axis('off')
plt.subplot(2, 3, 4), plt.title('R'), plt.imshow(r,cmap="gray"), plt.axis('off')
plt.subplot(2, 3, 5), plt.title('G'), plt.imshow(g,cmap="gray"), plt.axis('off')
plt.subplot(2, 3, 6), plt.title('B'), plt.imshow(b,cmap="gray"), plt.axis('off')
plt.show()
